package per.jdz.demo.utils;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.ReadConverterContext;

/**
 * @author Jdz
 * @date 2025/1/8
 */
public class StringToDoubleConverter implements Converter<Double> {
    @Override
    public Double convertToJavaData(ReadConverterContext<?> context) {
        String value = context.getReadCellData().getStringValue();
        if (value == null) return null;
        if ("-".equals(value)) return null;
        value = value.replace(",", "");
        return Double.parseDouble(value);
   /*     try {

        } catch (Exception e) {
            System.out.println(value);
            return null;
        }*/
    }
}
